package org.footballmanager.pandafootball.system.form.impl;

import lombok.Getter;
import lombok.Setter;
import org.footballmanager.pandafootball.system.domain.FootUserPerson;
import org.footballmanager.pandafootball.system.form.SearchForm;
import org.springframework.util.StringUtils;
import tk.mybatis.mapper.entity.Example;

import java.io.Serializable;

@Setter
@Getter
public class FootUserPersonSearchForm extends SearchForm implements Serializable {
    private static final long serialVersionUID = 8090668615941861546L;
    protected String qyName;
    protected String yw;
    protected Integer xycs;

    public Example buildSearchCommond() {
        Example example = new Example(FootUserPerson.class);
        Example.Criteria criteria = example.createCriteria();
        if (!StringUtils.isEmpty(qyName)) {
            criteria.andLike("qyName", "%" + qyName + "%");
        }
        if (!StringUtils.isEmpty(yw)) {
            criteria.andLike("yw", "%" + yw + "%");
        }
        if (xycs != null) {
            criteria.andEqualTo("xycs", xycs);
        }
        criteria.andEqualTo("delFlag", 0);
        example.orderBy("createTime").desc();
        return example;
    }

}
